﻿<UserControl x:Class="Yamaha.AVControl.Desktop.Controls.VolumeView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:con="clr-namespace:Yamaha.AVControl.Desktop.Controls"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\Styles\DefaultTheme.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="Button" BasedOn="{StaticResource ClearButton}">
                <Setter Property="Margin" Value="5" />
                <Setter Property="Padding" Value="5" />
            </Style>
            <Style TargetType="Line">
                <Setter Property="Stroke" Value="Black" />
                <Setter Property="StrokeThickness" Value="4" />
            </Style>
            <con:BooleanVisibilityConverter x:Key="bvConv" FalseVisibility="Hidden" />
            <con:BooleanVisibilityConverter x:Key="invConv" FalseVisibility="Visible" TrueVisibility="Hidden" />
        </ResourceDictionary>
    </UserControl.Resources>
    <DockPanel>
        <DockPanel DockPanel.Dock="Bottom">
            <Button Click="VolumeDown_Click" DockPanel.Dock="Left">
                <Line X1="0" X2="18" />
            </Button>
            <Button Click="VolumeUp_Click" DockPanel.Dock="Right">
                <Grid>
                    <Line X1="0" X2="18" Y1="9" Y2="9" />
                    <Line Y1="0" X1="9" X2="9" Y2="18" />
                </Grid>
            </Button>
            <Grid>
                <ProgressBar Margin="10" Height="18" Visibility="{Binding Muted, Converter={StaticResource invConv}}"
                    Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Value="{Binding Value}" />
                <ProgressBar Margin="10" Height="18" Visibility="{Binding Muted, Converter={StaticResource bvConv}}"
                    Foreground="Red"
                    Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Value="{Binding Value}" /> 
                <Slider x:Name="volSlider" VerticalAlignment="Center" Margin="10"
                    PreviewMouseDown="Slider_PreviewMouseDown" PreviewMouseUp="Slider_PreviewMouseUp"
                    IsSnapToTickEnabled="True" TickFrequency="0.5"
                    Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Value="{Binding Value}" />
            </Grid>
        </DockPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBlock Text="{Binding VolumeString}" FontWeight="Bold" FontSize="20" Margin="20, 0" VerticalAlignment="Center"  />
            <Button Click="ToggleMute_Click" Margin="10, 0" Padding="10" Style="{StaticResource ClearButton}">
                <Grid>
                    <Image Source="{StaticResource IMG_SPEAKER}" Height="24" Width="24" />
                    <Image Source="{StaticResource IMG_DISABLED}" Visibility="{Binding Path=Muted, Converter={StaticResource bvConv}}"
                           Height="12" Width="12" HorizontalAlignment="Right" VerticalAlignment="Bottom" />
                </Grid>                
            </Button>
        </StackPanel>
    </DockPanel>
</UserControl>
